(function(){

 // 获取地址
 let url = location.href
 console.log(url);


 // 解码地址
 let title = getUrlParams(url);
 console.log(title);

 // 获取对应位置的名称
 let titleid=title.title
 console.log(titleid);

 // 获取元素的个数
  let brandtitleid =title.brandtitleid
  console.log(brandtitleid);


  let html=
  `
  <a href="/index.html">首页></a>
  <a href="/pages/brandTitle.html">全部分类></a>
  <a href="#">${titleid}</a>
  <p>筛选</p>
  `
  $('#nav ').html(html)

  fetch(`http://chst.vip:1234/api/getbrandproductlist?brandtitleid=${brandtitleid}`)
    .then(body=>body.json())
    .then(res=>{
        
        console.log(res);
         let result= res.result
    

        let html = ""

        result.forEach(item => {
            
            html+=
            `<li>
        <a href="/pages/productlist.html?titleid=${titleid}&categoryid=${item.categoryId}&productid=${item.productId}">
            <div class="img">${item.productImg}</div>
            <div class="infoR">
                <div class="title">
                    <h4>${item.productName}<span>${item.productPrice}</span>
                    </h4>
                </div>
                <div class="other">
                    <span class="diyi">${item.productQuote}</span>
                    <span class="dier">
                        <i><img src="/assets/images/QQ-1.jpg" alt=""></i>
                        <span>${item.productCom}</span>
                    </span>
                </div>
            </div>
        </a>
    </li>
            `   
        });
        $('#product ul').html(html)

        
    })








})()